#ifndef _CTBRENDERER_H_
#define _CTBRENDERER_H_

#include <buola/widgets/ctreebox.h>

namespace buola { namespace gui {

class CTBRenderer : public UUncopiable
{
public:
    CTBRenderer(CTreeBox*);
    virtual ~CTBRenderer();
    
public:
////////////// Event handling //////////////
    virtual void OnSize(const CGeometryEvent &pE)=0;
    virtual void OnExpose(const CExposeEvent &pE)=0;

    virtual void OnBigChange()=0;
    virtual void OnNodeSelected(CTreeBox::SNode*)=0;
    virtual void OnNodeAdded(CTreeBox::SNode*)=0;
    virtual void OnNodeChanged(CTreeBox::SNode*)=0;
    virtual void OnNodeRemoved(CTreeBox::SNode*)=0;
    virtual void OnCursorChanged(CTreeBox::SNode*) {}
    virtual void OnFieldsChanged() {}
    virtual void OnXScrollChanged(int) {}
    
///////////////// interface ///////////////////
    virtual CRect_d GetNodeRect(CTreeBox::SNode *pN)=0;
    virtual CTreeBox::SNode *GetNodeAt(const CPoint_d&,int* =nullptr);
    virtual int GetNodesIn(const CRect_d&,CTreeBox::SNode*[]);
    
    virtual CSize_d GetIconSize()=0;
    virtual CSize_d GetMaxImageSize()=0;

    virtual PEditBox Edit(CTreeBox::SNode*)=0;

///////////////// internal /////////////////
    virtual int HitTestNode(CTreeBox::SNode*,const CPoint_d&)=0;
    virtual int HitTestNode(CTreeBox::SNode*,const CRect_d&)=0;
    
protected:
    CTreeBox *mTreeBox;
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
